package huawei.nk;

import java.util.Scanner;

public class NKBin {
    public static void main(String[] args) {
        Scanner scanner =new Scanner(System.in);
        while (scanner.hasNextLine()){
            System.out.println(Integer.parseInt(scanner.nextLine().substring(2),16));
        }
    }
}
